import java.util.ArrayList;


public class CommandManager {
private static CommandDecoder commandDecoder;
private static CommandExecutor commandExecutor = new CommandExecutor();
private static CommandRecorder commandRecorder = new CommandRecorder();
private CommandVerifier commandVerifier;
private String userInput = new String();
private static ArrayList<Task> virtualStorage = new ArrayList<Task>();
private static ArrayList<Command> history = new ArrayList<Command>();
private static ArrayList<String> content = new ArrayList<String>();

public CommandManager() {
	
}
public CommandManager(String userInput) {
	this.userInput=userInput;
}

public ArrayList<Task> console() {
	commandDecoder = new CommandDecoder(userInput);
	content = commandDecoder.decodeTheContent(userInput);
	commandVerifier = new CommandVerifier(content);
	if(commandVerifier.verifyCommand()) {
		commandRecorder.record(commandVerifier.approveCommand());
	}
	else {
		return null;
	}
	virtualStorage = commandExecutor.executeCommand(commandVerifier.approveCommand(),history);
	//displayTheTask(virtualStorage);
	return virtualStorage;
}

public void setUserInput(String userInput) {
	this.userInput = userInput;
}
private static void displayTheTask(ArrayList<Task> storage) {
	for(int INDEX =0;INDEX<storage.size();INDEX++) {
		System.out.println(storage.get(INDEX));
	}
}
}
